home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / DB_CLIPP / 0643C.ZIP / DBCANT.TXT < prev    next >
Text File  |  1986-01-10  |  14KB  |  397 lines

  1.  
  2.  
  3.  
  4.           Decant 0.9                             Copyright M.D. Sadler
  5.                                                             1985, 1986
  6.  
  7.  
  8.  
  9.  
  10.      1.0  INTRODUCTION
  11.  
  12.           Decant reduces  the size  of dBase III* programs by removing
  13.           leading  and  training  blank  spaces,  reducing  dBase  III
  14.           keywords to  four characters  (optional),  and  by  removing
  15.           comment lines  (optional).   This results  in dBase programs
  16.           which run faster and take up less space on disk.
  17.  
  18.           dBase III is an interpretive program language.  The computer
  19.           must interpret  each line  of the program as it is executed.
  20.           If a  line of  code  is  executed  ten  times,  it  must  be
  21.           interpreted ten  times.   If the  number of  characters that
  22.           dBase must  interpret is  reduced, the  program will execute
  23.           faster.  This is what Decant does.
  24.  
  25.           It  is  good  programing  practice  to  make  programs  self
  26.           documenting.   That is,  the program contains all the notes,
  27.           as comments,  needed to  allow another programmer to quickly
  28.           understand how  the program  works.   This also  allows  the
  29.           original programmer  to remember  his own  work.   Typically
  30.           certain rules  of indentation are followed to show IF-ENDIF,
  31.           DO WHILE-ENDDO,  and CASE program structures.  While this is
  32.           good programing  practice, for  interpretive languages  like
  33.           dBase, it results in slower running programs.  Decant allows
  34.           a dBase  programmer to  follow good  documentation practices
  35.           and still  generate  code  which  will  execute  faster  and
  36.           require less disk space.
  37.  
  38.           Who will  benefit most from Decant? If you include extensive
  39.           comment lines,  never abbreviate  dBase keywords,  carefully
  40.           follow the rules of indentation, and use a text editor which
  41.           pads program lines out to 80 spaces, Decant will benefit you
  42.           the most.  If you never add comment lines, always abbreviate
  43.           dBase keywords to four letters, never indent, and use a text
  44.           editor which  removes trailing  blanks, you  might  as  well
  45.           forget Decant.   Most  of us fall somewhere in between these
  46.           two these  two extremes.   Most  of the programs that I have
  47.           written are  reduced in  size by 20 to 30 percent by Decant.
  48.           The speed  improvement depended  upon the program structure.
  49.           If there  were lots  of comments  within  loops,  the  speed
  50.           improvement was  very significant.    One  program  which  I
  51.           copied from a magazine was reduced in size by 58 percent and
  52.           ran twice  as fast.   The results you get will depend on how
  53.           your program structures and the extent of your comments.
  54.  
  55.  
  56.  
  57.  
  58.      ____________________
  59.  
  60.           *    dBase III is a trademark of Ashton Tate.
  61.  
  62.  
  63.  
  64.                                    Page - 1 -
  65.  
  66.  
  67.  
  68.  
  69.  
  70.           Decant 0.9                             Copyright M.D. Sadler
  71.                                                             1985, 1986
  72.  
  73.      2.0  COMPATIBILITY
  74.  
  75.           Decant is written for IBM PC's and close compatibles running
  76.           under PC  or MS  DOS 2.0+.   I have tested this program on a
  77.           IBM PC-1  running PC-DOS  2.1, with black and white monitor,
  78.           PC-2 with  color monitor  and external  hard disk  ,  and  a
  79.           Compaq Portable  using MS-DOS 2.11.  I have test Decant with
  80.           dBase III  version 1.1.   It  is should   be possible to use
  81.           Decant with  dBase II  by modifying  the keyword  file  (see
  82.           section 5.0).   Since  I do  not have  access to dBase II, I
  83.           have not been able to test this.
  84.  
  85.  
  86.      3.0  INSTALLATION
  87.  
  88.           Decant uses  two files.   DECANT.COM  is the  program  file.
  89.           DECANT.KEY contains  all the dBase keywords longer than four
  90.           characters.   Both of  these files  must be on the same disk
  91.           drive and  in the  current subdirectory  to execute  Decant.
  92.           From the  DOS prompt, type "DECANT" and return (please leave
  93.           out the  quotation marks).   Decant  will load  the  keyword
  94.           file, DECANT.KEY, and then display the main menu.
  95.  
  96.  
  97.      4.0  MAIN MENU
  98.  
  99.           The main  menu allows the user to select which files will be
  100.           compressed and  the name of the output files.  From the main
  101.           menu, the user may select or deselect the keyword truncation
  102.           and comment deletion options.
  103.  
  104.           The default  selections will  compress all  files on drive A
  105.           with the file extension .PRG and write the resulting program
  106.           files with the same name on drive B.  Dbase keywords will be
  107.           shortened to  four  characters  and  comments  will  not  be
  108.           deleted.
  109.  
  110.           Main Menu  options may  be selected  by pressing  the  first
  111.           letter of the desired command.  The available option letters
  112.           are highlighted on the Main Menu.  The subcommands for input
  113.           and output  file selections  require pressing  first "I" for
  114.           (I)nput or  "O" for  (O)utput and  then the  letter for  the
  115.           subcommand.
  116.  
  117.  
  118.           4.1  (I)nput
  119.  
  120.                By typing  "I", you may change the selected input drive
  121.                and path, the file mask, or the file extension.  Decant
  122.                uses the normal DOS filenaming conventions and supports
  123.                wildcard  selections.     Typing  "I"  will  allow  the
  124.                following sub-commands to be given to Decant:
  125.  
  126.  
  127.  
  128.  
  129.  
  130.                                    Page - 2 -
  131.  
  132.  
  133.  
  134.  
  135.  
  136.           Decant 0.9                             Copyright M.D. Sadler
  137.                                                             1985, 1986
  138.  
  139.                4.1.1     (D)rive\Path
  140.  
  141.                          After pressing  "D", you  will be asked for a
  142.                          new Drive\Path.   You should respond with the
  143.                          drive and  path that your input program files
  144.                          exist on.  Examples:
  145.  
  146.                               C:\DBASE\PROGRAMS\MASTERS
  147.                               A:\
  148.                               B:\
  149.  
  150.  
  151.                4.1.2     (F)ile Mask
  152.  
  153.                          After pressing  "F", you  will be asked for a
  154.                          new input  file mask.  This specification can
  155.                          be as  specific as  a single file name or you
  156.                          may use the DOS * and ? wildcards.  Examples:
  157.  
  158.                               menu
  159.                               program1
  160.                               program?
  161.                               pro*
  162.  
  163.  
  164.                4.1.2     File (E)xtension
  165.  
  166.                          Pressing "E"  allows  the  selection  of  the
  167.                          input file extension.  Examples:
  168.  
  169.                               .PRG
  170.                               .CMD
  171.                               .OLD
  172.  
  173.  
  174.           4.2  (O)utput
  175.  
  176.                Pressing "O"  allows changing the output file drive and
  177.                extension.   Decant will  not willingly  overwrite  the
  178.                input file.   Decant  will test for duplicate input and
  179.                output  specifications.    If  you  should  succeed  in
  180.                fooling Decant  into trying to overwrite the input file
  181.                the results  are unpredictable.   For  this reason, the
  182.                output  specification   should  include   a   different
  183.                Drive\Path or Extension from the input specification.
  184.  
  185.  
  186.           4.3  (K)eyword Truncation
  187.  
  188.                When this  option is  on, Decant will shorten all dBase
  189.                III keywords  to four characters.  Pressing "K" toggles
  190.                this option on and off.
  191.  
  192.  
  193.  
  194.  
  195.  
  196.                                    Page - 3 -
  197.  
  198.  
  199.  
  200.  
  201.  
  202.           Decant 0.9                             Copyright M.D. Sadler
  203.                                                             1985, 1986
  204.  
  205.           4.4  (C)omment Deletion
  206.  
  207.                When this  option is on, Decant will delete all comment
  208.                lines.  Pressing "C" toggles this option on and off.
  209.  
  210.  
  211.           4.5  (G)o
  212.  
  213.                This is  the execute  command for Decant.  While Decant
  214.                is operating,  Decant will  display what  files  it  is
  215.                currently  operating   on.    As  each  input  file  is
  216.                completed, the  input file  size, output  file size and
  217.                the percent  reduction is  displayed.  At the same time
  218.                Decant checks to see if any key has been pressed.  If a
  219.                key has  been pressed,  Decant will ask the user if the
  220.                program should be aborted.
  221.  
  222.  
  223.           4.6  (Q)uit
  224.  
  225.                Return to DOS.
  226.  
  227.  
  228.      5.0  THE KEYWORD FILE, DECANT.KEY
  229.  
  230.           The Keyword file is a ascii file containing all of the dBase
  231.           keywords longer  than four  characters.   These keywords are
  232.           listed one  word on  a line  and in alphabetical order.  The
  233.           keyword file  may be  edited with any word processor or text
  234.           editor capable  of ascii  file output.  Decant compares each
  235.           word  of   the  input   file  with  the  words  included  in
  236.           DECANT.KEY.   If the  words match,  the word  from the input
  237.           file is  shorted to  the first  four characters before it is
  238.           written to the output file.
  239.  
  240.           While it is poor practice, dBase will often allow you to use
  241.           dBase keywords  as variable names.  If you have used a dBase
  242.           keyword as  a variable,  Decant  will  shorten  it  to  four
  243.           characters and  your program may not work any more.  If this
  244.           happens, you may change your variable name or you can delete
  245.           the keyword from DECANT.KEY.
  246.  
  247.           If future  revisions of dBase include new keywords, they may
  248.           be added to DECANT.KEY.  If you have a copy of dBase II, you
  249.           may be able to use Decant if you revise DECANT.KEY.
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.                                    Page - 4 -
  263.  
  264.  
  265.  
  266.  
  267.  
  268.           Decant 0.9                             Copyright M.D. Sadler
  269.                                                             1985, 1986
  270.  
  271.      6.0  USAGE SUGGESTIONS
  272.  
  273.  
  274.           6.1  Floppy Disk Users
  275.  
  276.  
  277.           The easiest way to use Decant is to develop your dBase
  278.           programs as you normally would on one floppy.  When you are
  279.           satisfied that your programs are complete.  Use Decant to
  280.           compress your programs on to another disk with the same file
  281.           names.  You may then keep the diskette with the original
  282.           program files for backup and future updates.  Use the
  283.           compressed files for everyday use.
  284.  
  285.  
  286.           6.2  Hard Disk Users
  287.  
  288.                If you  have a  hard disk,  keep your  original program
  289.                files in  a  separate  subdirectory.    Use  Decant  to
  290.                compress your programs into a working subdirectory.
  291.  
  292.  
  293.      7.0  COPYRIGHT NOTICE
  294.  
  295.           Decant is  offered as is.  I have made every effort to debug
  296.           and  test   Decant  that   I  can  think  of.    However,  I
  297.           specifically disclaim  all other  warranties,  expressed  or
  298.           implied, including but not limited to, implied warranties of
  299.           merchantability and  fitness for  a particular  purpose with
  300.           respect to  defects in the program or the documentation, and
  301.           the  program  license  granted  herein  in  particular,  and
  302.           without limiting  operation  of  the  program  license  with
  303.           respect to  any particular application, use, or purpose.  In
  304.           no event  shall I  be liable  for any  loss of profit or any
  305.           other  commercial  damage,  including  but  not  limited  to
  306.           special, incidental, consequential or other damages.
  307.  
  308.           A limited  license is  granted to all users of this program,
  309.           to make  copies of this program and distribute them to other
  310.           users, on the following conditions:
  311.  
  312.                1.   The program  is not to be distributed to others in
  313.                modified form.
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.                                    Page - 5 -
  329.  
  330.  
  331.  
  332.  
  333.  
  334.           Decant 0.9                             Copyright M.D. Sadler
  335.                                                             1985, 1986
  336.  
  337.                2.   No fee  is to  be charged (or any other considera-
  338.                tion received)  ,except as  noted below, for copying or
  339.                distributing the  program without  the express  written
  340.                permission from:
  341.  
  342.  
  343.                                  Mark D. Sadler
  344.                             8502 Scenic Green Drive
  345.                               Houston, Texas 77088
  346.                                  (713) 999-3447
  347.                            Compuserve ID: 75135,1552
  348.  
  349.                Clubs may freely copy and distribute this program for a
  350.                nominal diskette or copying fee not to exceed $8.
  351.  
  352.           You are  encouraged to  copy and  share  this  program  with
  353.           others users.   If  you  find  this  program  of  use,  your
  354.           contribution of $15 (suggested) will be appreciated.  If you
  355.           will let me know of any problems you have, I will be glad to
  356.           try and help you out.
  357.  
  358.  
  359.      8.0  VERSIONS
  360.  
  361.           VERSION 0.8    12/15/85  Initial Release
  362.  
  363.           VERSION 0.9    1/11/86   Corrected handling of TEXT-ENDTEXT.
  364.                                    Corrected handling  of strings  not
  365.                                    preceeded with a space.
  366.  
  367.  
  368.  
  369.           
  370.  
  371.           
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.                                    Page - 6 -
  395.  
  396.  
  397.